<?php

namespace App\Admin\Controllers;

use App\Extends\BaseController;
use App\Services\Permission\AdminService;
use Illuminate\Http\Request;
use App\Helpers\ApiResponseTrait;

class LoginController
{
    use ApiResponseTrait;

    /**
     * 登录
     * @param Request $request
     * @param AdminService $adminService
     * @return \Illuminate\Http\JsonResponse
     */
    public function login(Request $request, AdminService $adminService)
    {
        $data  = $request->validate(
            [
                'account' => ['required'],
                'password' => ['required'],
            ],
            [
                'account.required'  => '请输入登录账号',
                'password.required' => '请输入登录密码'
            ]
        );
        return $this->success($adminService->login($data['account'], $data['password']));
    }


    public function logout()
    {

    }
}
